import request from '@/utils/request'

export function getLogistics(query) {
	return request({
		url: "/api/pms/freight/list",
		method: "POST",
		params: query
	})
}

export function getLogisticsInfo(id) {
	return request({
		url: `/api/pms/freight/info/${id}`,
		method: "GET"
	})
}

export function createLogistics(query) {
	return request({
		url: "/api/pms/freight/create",
		method: "POST",
		data: query
	})
}

export function updateLogistics(id, query) {
	return request({
		url: `/api/pms/freight/update/${id}`,
		method: "POST",
		data: query
	})
}

export function deleteLogistics(id) {
	const query = new FormData();
	let ids = id.toString();
	query.append("ids", ids)
	return request({
		header: {
			"Content-Type": "multipart/form-data"
		},
		url: "/api/pms/freight/delete",
		method: "POST",
		data: query
	})
}

export function getDispatchTime() {
	return request({
		url: "/api/pms/freight/getDispatchTimeInfo",
		method: "GET"
	})
}

export function updateDispatchTime(query) {
	return request({
		url: "/api/pms/freight/modifyDispatchTimeInfo",
		method: "POST",
		data: query
	})
}

export function getCitywideDispatch() {
	return request({
		url: "/api/pms/freight/getCitywideDispatchInfo",
		method: "GET"
	})
}

export function updateCityWide(query) {
	return request({
		url: "/api/pms/freight/modifyCitywideDispatchInfo",
		method: "POST",
		data: query
	})
}
